import {Switch, Route, Redirect} from "react-router-dom";
import Home from "./Home/Home";
import About from "./About/About";
import Dest from "./Dest/Dest";
function App() {

    return (
        <Switch>
            <Route path="/:name?" exact={true} render={_=>{
                return (
                    <>
                        <Route component={Home} />
                    </>
                )
            }}/>
            <Route path="/about" exact={true} render={()=><About />}/>
            <Route path="/dest" exact={true} children={props=>{
                //在没有switch时会同时执行这里；
                console.log('dest_props', props);
                return <Dest props={props} />
            }} />
            <Redirect to={{pathname: "/"}}/>
        </Switch>
    );
}

export default App;
